Skip to content

Prefactor for Trampoline MPP accumulation#4510

Open
carlaKC wants to merge 9 commits intolightningdevkit:mainfrom
carlaKC:2299-mpp-prefactor
Open

Prefactor for Trampoline MPP accumulation#4510
carlaKC wants to merge 9 commits intolightningdevkit:mainfrom
carlaKC:2299-mpp-prefactor

Conversation

@carlaKC
Copy link
Contributor

@carlaKC carlaKC commented Mar 24, 2026

This PR contains a set of refactors pulled out of #4493:

  • Extract common timeout / MPP logic into separate functions
  • Allow construction of blinded trampoline paths
  • Misc constructors + validation

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 24, 2026

👋 Thanks for assigning @valentinewallace as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

carlaKC added 9 commits March 24, 2026 13:17
We'll re-use this logic to timeout tick incoming trampoline MPP.
We'll re-use this to check trampoline MPP timeout in future commits.
We're going to use the same logic for trampoline and for incoming MPP
payments, so we pull this out into a separate function.
We'll only use this for non-trampoline incoming accumulated htlcs,
because we want different source/failure for trampoline.
To use helper functions for either trampoline or regular paths.
Added so that we can create ClaimableHTLC for trampoline tests in a
separate file, rather than needing to make several fields pub(crate)
just for the sake of tests.
For trampoline payments, we don't want to enforce a minimum cltv delta
between our incoming and outer onion outgoing CLTV because we'll
calculate our delta from the inner trampoline onion's value. However,
we still want to check that we get at least the CLTV that the sending
node intended for us and we still want to validate our incoming value.
Refactor to allow setting a zero delta, for use for trampoline payments.
@carlaKC carlaKC force-pushed the 2299-mpp-prefactor branch from 40f75a4 to f15271e Compare March 24, 2026 17:19
@ldk-claude-review-bot
Copy link
Collaborator

ldk-claude-review-bot commented Mar 24, 2026

I've completed a thorough re-review of every file and hunk in this PR diff, including examining the source code for context around the changes. My prior review found no issues, and this re-review confirms that finding.

No issues found.

The refactoring is semantically equivalent to the original code:

  • check_mpp_timeout correctly mirrors the old inline MPP completion check (using <= vs >= with correct return value semantics)
  • committed_to_claimable tracking is preserved through handle_claimable_htlc's Err(bool) return
  • fail_receive_htlc! correctly reconstructs HTLCPreviousHopData from captured Copy fields, independent of the moved prev_hop
  • check_onchain_timeout's cltv_expiry - buffer subtraction is identical to the pre-existing inline expression
  • TLV serialization is unaffected by the trampoline_shared_secret rename (tag 0 unchanged)
  • previous_hop_data() using core::slice::from_ref avoids the prior vec![prev_hop] heap allocation while preserving iteration semantics

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 91.08527% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.19%. Comparing base (ab31f99) to head (f15271e).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 94.36% 12 Missing ⚠️
lightning/src/blinded_path/payment.rs 75.60% 9 Missing and 1 partial ⚠️
lightning/src/ln/onion_payment.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #4510    +/-   ##
========================================
  Coverage   86.19%   86.19%            
========================================
  Files         160      160            
  Lines      107537   107713   +176     
  Branches   107537   107713   +176     
========================================
+ Hits        92693    92848   +155     
- Misses      12220    12238    +18     
- Partials     2624     2627     +3     
Flag Coverage Δ
tests 86.19% <91.08%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@valentinewallace valentinewallace requested review from valentinewallace and removed request for wpaulino March 25, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants